const mongoose = require('mongoose');

// 替换为你的 MongoDB 连接字符串
const uri = 'mongodb+srv://zzycbb:<db_password>@cluster0.hlydq.mongodb.net/?retryWrites=true&w=majority&appName=Cluster0'; 

mongoose.connect(uri, {
    useNewUrlParser: true,
    useUnifiedTopology: true
});

const db = mongoose.connection;

db.on('error', console.error.bind(console, 'MongoDB 连接错误:'));
db.once('open', function() {
    console.log('成功连接到 MongoDB 数据库');
});

module.exports = mongoose;
